home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-10-29 | 1.3 KB | 54 lines | [TEXT/CWIE] |
- // WindowAccessor.cp, the WindowAccessor class, to be used for direct access to
- // window pixel-maps.
-
- // copyright © 1995, Macneil Shonle. All rights reserved.
-
- #ifndef __WINDOWACCESSOR__
- #include <WindowAccessor.h>
- #endif
-
- #ifndef __GWORLDSETTER__
- #include <GWorldSetter.h>
- #endif
-
- static Rect WindowToGlobalRect(WindowRef window);
-
- // sets up direct blitting information for a window
- // may throw: xalloc
- WindowAccessor::WindowAccessor(WindowRef window) throw(xalloc)
- : VideoAccessor(::WindowToGlobalRect(window))
- {
- }
-
- // intentionally left blank
- WindowAccessor::~WindowAccessor()
- {
- }
-
- // makes a copy of the given WindowAccessor
- // may throw: xalloc
- WindowAccessor& WindowAccessor::operator=(const WindowAccessor& wa) throw(xalloc)
- {
- this->BufferAccessor::operator=(wa);
- return *this;
- }
-
- // caches in the given WindowRef's pixel information
- // may throw: xalloc
- WindowAccessor& WindowAccessor::operator=(WindowRef window) throw(xalloc)
- {
- construct(::WindowToGlobalRect(window));
- return *this;
- }
-
- // returns a global rectangle of the window's bounds
- Rect WindowToGlobalRect(WindowRef window)
- {
- GWorldSetter setTo(window);
-
- Rect global = window->portRect; // NOTE: directly accessing window's portRect
- ::LocalToGlobal(&((Point*)&global)[0]);
- ::LocalToGlobal(&((Point*)&global)[1]);
-
- return global;
- }